package cn.wolfcode.p2p.website;

import cn.wolfcode.p2p.CoreConfig;
import cn.wolfcode.p2p.website.web.interceptor.CheckLoginInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Hello world!
 *
 */
@SpringBootApplication
@Import(CoreConfig.class)
@PropertySource("classpath:application-website.properties")
public class WebSiteApplication implements WebMvcConfigurer {

    // 登录拦截
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new CheckLoginInterceptor())
                .addPathPatterns("/**");
    }

    public static void main(String[] args ) {
        SpringApplication.run(WebSiteApplication.class, args);
    }
}
